#include <stdio.h>
#include <stdlib.h>

#include "Ringbuf.h"

#define  BUFSIZE	1024

int main(){
	Datatype arr[] = {2,34,1,23,42,354,45,46,45675,6758,687,324,241,34};
	int j = 0;
	Datatype data_readbuf[BUFSIZ];

	int data_len = sizeof(arr)/sizeof(*arr);
	RINGB *phead = NULL;
	ALLPT *np = NULL;
	np = Ringbuf_init(&phead,np,30);
	
	if(Ringbuf_write(np,arr,data_len) < 0){
		exit(1);
	}
	if(Ringbuf_read(np,data_readbuf,4) < 0){
		exit(1);
	}
	while(data_readbuf[j] != '\0'){
		
		printf("%d ",data_readbuf[j]);
		j++;
	}
	printf("\n");

	Ringbuf_display(np);
	Ringbuf_free(phead);
	exit(0);
}